﻿<Window x:Class="Resources.ResourceFromLibrary"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:res="clr-namespace:ResourceLibrary;assembly=ResourceLibrary"
    Title="ResourceFromLibrary" Height="300" Width="300"    
    >
  <Window.Resources>
    <ImageBrush x:Key="TileBrush" TileMode="Tile"
                ViewportUnits="Absolute" Viewport="0 0 32 32"
                ImageSource="happyface.jpg" Opacity="0.3"></ImageBrush>
  </Window.Resources>
  <StackPanel Margin="5">
    <Button Background="{StaticResource TileBrush}" Padding="5"
            FontWeight="Bold" FontSize="14" Margin="5"
              >A Resource From This Assembly</Button>

    <Button Background="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type res:CustomResources}, ResourceId=SadTileBrush}}"
            Padding="5" Margin="5"
            FontWeight="Bold" FontSize="14">
      A Resource From ResourceLibrary</Button>

    <Button Background="{DynamicResource {x:Static res:CustomResources.SadTileBrush}}"
        Padding="5" Margin="5"
        FontWeight="Bold" FontSize="14">
      A Resource From ResourceLibrary
    </Button>


  </StackPanel>
</Window>
